package com.example.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Data
@Document("student")
@CompoundIndex(name = "ne",def = "{'studentName':1,'studentAge':1}",unique = true)
public class Student implements Serializable {
       @Id
    private String id;

    private String studentName;

    private Integer studentAge;
    @TableField("score")
    @Indexed(name = "socre",unique = true)
    private Double studentScore;
     @TableField("brithday")
    private LocalDateTime studentBirthday;
    @Transient
    private LocalDateTime modifiedBrithday;
}
